package com.docker.login;

import com.docker.core.mvc.validator.BaseValidator;
import com.jfinal.core.Controller;

public class LoginValidator extends BaseValidator {

    @Override
    protected void validate(Controller controller) {
        if ("sms".equals(getActionMethodName())) {
            validateUUID("app_id", false, "应用识别错误");
            validateMobile("account", false, "手机号错误");
        } else if ("index".equals(getActionMethodName())) {
            validateUUID("app_id", false, "应用识别错误");
            validateMobile("account", false, "手机号错误");
            validateNumber("sms_code", 6, false, "验证码错误");
        } else if ("info".equals(getActionMethodName())
                || "auth".equals(getActionMethodName())
                || "logout".equals(getActionMethodName())) {
            validateUUID("app_id", false, "应用识别错误");
            validateUUID("token", false, "登录状态错误");
        }
    }

}
